 %inner P1=[288,854];P2=[424,495];P3=[226,26];
%-177.1895 472.5118 601.6100
%outter P1=[726,488];P2=[609 30];P3=[585,957];
%-172.4734 473.5784 898.5891
    
%% 
% 
%   左2 17mm 2 para_im2bw = 0.0038;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99;  PIV 0-2.5 m/s
%   左2 35mm 5 para_im2bw = 0.0038;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99;  PIV 0-2.5 m/s
%   左2 45mm 1 para_im2bw = 0.0038;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99;  PIV 0-2.5 m/s
% 
%   左3 17mm 1 para_im2bw = 0.0038;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99;  PIV 0-3 m/s
%   左3 35mm 3 para_im2bw = 0.0038;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99;  PIV 0-3 m/s
%   左3 45mm 3 para_im2bw = 0.0038;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99;  PIV 0-3 m/s
% 
%   初始火核 17mm 1 para_im2bw = 0.007;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99;
%   初始火核 35mm 2 para_im2bw = 0.007;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99; PIV 0-3 m/s 
%   初始火核 45mm 4 para_im2bw = 0.007;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.99; PIV 0-3 m/s 

%%
%THIS IS A SCRIPT TO RUN THE FLAME_ANALYSIS
%funtions folder must be with the folder
clear all; close all;warning('off','all');clc;
global str first last gap a b r1 r2 a_inner b_inner a_outer b_outer

a=-715;b=650;r1=860;r2=1214;
% a=-748;b=700;r1=892;r2=1280;%冷态用的
% a=-730;b=700;r1=883;r2=1250;
a_inner = a;   
a_outer = a;
b_inner = b;
b_outer = b;
% b_inner = b + 30; %左侧三 
% b_outer = b + 30;%左侧三
% r1 = r1 + 2;%左侧三
% r2 = r2 + 16;%左侧三



currentFolder = pwd;
for i = 1:length(currentFolder)-length('functions')
    act_Folder(i) = currentFolder(i);
end


%% 7-13
first_file = 0;%%%%%change when use  
last_file = 0;%%%%%change when use
first=230;last=first;gap=1;  %103 107 121 138 141 165

for num_file=first_file:last_file
    timer_1=clock;
    str_append ='初始火核\8-286\4'; 
    str=strcat(act_Folder,str_append,'\');
%     str=strcat(act_Folder,'冷态piv\',str_append,'\'); %%%%%change when use
    fprintf('''%d'' th case in ''%s'' \n', num_file,str_append);

    %% 1 data to ./origin_visual
    para_enhance = 150;
%     show_origin_tifs(para_enhance);

    %% 2 ./high_pass_filter 
    para_hpf = 0.02; %0.0001可以0.001可以
	remain = 999;
    count = 0;
    while(remain>=999)
        hpf_start= count*1000+1;
        hpf_end= count*1000+999;
        output_start = count*1000+350;
        output_end = count*1000+649;
%         hpftest(hpf_start,hpf_end,output_start,output_end,para_hpf);
%         high_pass_filter(hpf_start,hpf_end,output_start,output_end,para_hpf);
        fprintf('#%d ',count);
        count = count + 1;
        remain = remain - 1000;
    end
%     hpf_start= first;
%     hpf_end= last;
%     output_start = first;
%     output_end = last;
%     hpftest(hpf_start,hpf_end,output_start,output_end,para_hpf);
%     high_pass_filter(hpf_start,hpf_end,output_start,output_end,para_hpf);


    %% 3 ./flame_front
%     para_im2bw = 0.007;row_gauss=12;col_gauss=12;sigma_gauss = 5;para_canny = 0.9; 
    para_im2bw = 0.005;row_gauss=10;col_gauss=10;sigma_gauss = 5;para_canny = 0.9;
    f_enhance = 25;%f_enhance指最终输出底图亮度
    show_flamefront(para_im2bw,row_gauss,col_gauss,sigma_gauss,para_canny,f_enhance);
  
    
    
    %%
    timer_2=clock;
    minutes = 60*(timer_2(4)-timer_1(4)) + timer_2(5)-timer_1(5);
    seconds = timer_2(6)-timer_1(6);
    seconds = int8(seconds);
    if seconds < 0
        minutes = minutes - 1;
        seconds = seconds + 60;
    end
    fprintf('ellapsed time:  %d min  %d sec\n',minutes,seconds);
end

